import { fetchUserPosts, fetchUserProfile } from '@/lib/api/account/profile';
import UserPostsList from '../_component/UserPostsList';

type Props = {
	params: Promise<{ sid: string }>;
};

export default async function UserProfilePostsPage({ params }: Props) {
	const { sid } = await params;
	const [profileRes, postsRes] = await Promise.all([
		fetchUserProfile(sid),
		fetchUserPosts(sid, 1, 20)
	]);

	const list = postsRes.data?.list ?? [];
	const author = profileRes.data ?? null;

	return <UserPostsList list={list} author={author} />;
}